package com.cn.sl.server.common.id.generator

import org.dromara.hutool.core.data.id.IdUtil
import org.hibernate.HibernateException
import org.hibernate.engine.spi.SharedSessionContractImplementor
import org.hibernate.id.IdentifierGenerator
import java.io.Serializable

class SnowflakeIdGenerator : IdentifierGenerator {
    @Throws(HibernateException::class)
    override fun generate(session: SharedSessionContractImplementor, `object`: Any): Serializable {
        return IdUtil.getSnowflakeNextId()
    }
}